/******************************************************************************
 * XWiki.JavaScriptExtension[0]: JavaScript Utilities for Exhibit
 * Copyright (C) 2009-2011, Niels Mayer. All Rights Reserved. http://nielsmayer.com
 ******************************************************************************/
/****************************************************************************
 * Called out of XWiki.JavaScriptExtension[2]:onLoadExhibit() via macro 
 * #exhibit_create(). This allows overriding existing Exhibit code by 
 * importing another Macro/Document after Macros.Exhibit to redefine
 * addExhibitInterceptorsAndOverides(), e.g.:
 * #includeMacros("Macros.Exhibit")##
 * #exhibit_xwiki_init()##
 * #includeMacros("Macros.ExhibitInterceptorsJS")##
 * #exhibitinterceptors_xwiki_init()##
 ****************************************************************************/
function addExhibitInterceptorsAndOverides() {
}
/****************************************************************************
 * Recursively traverse up DOM hierarchy from parameter onclickedElt, whose
 * onclick="buttonFunct(this)" invokes this function passing 'this' as
 * 'onclickedElt'. Continue traversing up parentNode's until finding an
 * element with ex:itemID attribute -- this is the Exhibit Lens that
 * contains of the the invoking onclickedElt.  If found, returns the value of 
 * ex:itemID, the Exhibit ID (a string) of the item displayed by the lens.
 * If no ex:itemID attribute found in traversing the DOM to it's root, this
 * returns null.
 ****************************************************************************/
function exhibitFindLensContainerItemID(eltInDOM) {
  if (eltInDOM != null) {
    var id = eltInDOM.getAttribute("ex:itemID");
    if ((id != null) && (id != ""))
      return (id); //found it: stop recursion and return result
    else
      return (exhibitFindLensContainerItemID(eltInDOM.parentNode)); //recurse...
  }
  else
    return (null); //never found it, return failure
}
